<!--照管员管理页-->
<template>
    <div style="height: 100%;">

        <m-page-list
                :option="option"
                :page="page"
                :total="total"
                :table-data="tableData"
                :table-loading="tableLoading"
                v-model:value="query"
                @h-btn-click="hBtnClick"
                @col-btn-click="colBtnClick"
                @search-data="searchData"
        />

        <m-dialog-form ref="dialogRef" :data="dialogData" v-model:show="dialogShow" :option="dialogOption" @confirm="dialogConfirm" ></m-dialog-form>
    </div>

</template>

<script setup>

  import {ref,reactive,onMounted,nextTick} from 'vue'
  //组件
  import MPageList from '@/components/PageList'
  import MDialogForm from '@/components/DialogForm/DialogForm'
  //请求
  import {getCaretakerData,editCaretakerData,addCaretakerData,delCaretakerData} from '@/request/api/basicData'

  import {usePageList} from "../../composables/pageList";

  //引用类型字段参数
  import {refOpt} from "../const";

  let opts = {
    // auth_id: 'stop',
    getApi: getCaretakerData,
    addApi: addCaretakerData,
    editApi: editCaretakerData,
    delApi: delCaretakerData,
    idKey: 'row_id',
  };
  let {option,page,total,tableLoading,tableData,query,dialogRef,dialogShow,dialogData,
    hBtnClick,colBtnClick,searchData,dialogOption,dialogConfirm} = usePageList(opts);

  //  查询条件参数配置
  option.conditions = [
    {label: '照管员工号',type: 'text',field_id: 'caretaker_no',col: 12},
    {label: '照管员名称',type: 'text',field_id: 'caretaker_name',col: 12},
  ];
  // 表格列显示参数配置
  option.cols = [
    {prop: 'user_id', label: '用户编号',},
    {prop: 'caretaker_no', label: '照管员工号'},
    {prop: 'caretaker_name', label: '照管员名称',},
    {prop: 'phone', label: '手机号码',},
    {prop: 'is_used', label: '启用标识',type: 'bool'},
    {prop: 'modify_name', label: '修改员名',},
    {prop: 'modify_time', label: '修改时间',},
    {prop: 'input_name', label: '录入员名',},
    {prop: 'input_time', label: '录入时间',},

  ];

  // 新增编辑弹窗录入项配置
  dialogOption.fieldList = [
    {...refOpt.user_name,editDisabled: true,label: '用户编号',field_id:'user_id',entityKey: 'user_id',valueKey: [{caretaker_no: 'user_id'},{caretaker_name: 'user_name'},'user_id'] ,col: 3},
    {field_id: 'caretaker_no',editDisabled: true, label: '照管员工号',type: 'text',col: 3,required:true},
    {field_id: 'caretaker_name', label: '照管员名称',type: 'text',col: 3,required:true},
    {field_id: 'phone', label: '手机号码',type: 'text',col: 3},
    {field_id: 'is_used', label: '启用标识',type: 'bool',col: 3},
    {...refOpt.operation_group_id,field_id: 'operation_group_no',col:3, label: '所属营运组编号'},
    {...refOpt.operation_group_name,editDisabled: true,col:3, label: '所属营运组名称',valueKey: [{'operation_group_no': 'operation_group_id'},'operation_group_name'] ,},
    {field_id: 'remarks', label: '备注',type: 'text',col: 3},
  ];

</script>

